<?php

use yii\helpers\Html;
use common\widgets\MyActiveForm;
use chenkby\region\Region;
use common\models\DdRegion;

/* @var $this yii\web\View */
/* @var $model common\models\DdDelivery */
/* @var $form yii\widgets\MyActiveForm */
?>

<div class="dd-delivery-form">

    <?php $form = MyActiveForm::begin(); ?>
    <?= $form->field($model, '地区')->widget(\chenkby\region\Region::className(), [
        'model'=>$model,
        'url'=> \yii\helpers\Url::toRoute(['get-region']),
        'province'=>[
            'attribute'=>'province',
            'items'=>DdRegion::getRegion(),
            'options'=>['class'=>'form-control form-control-inline','prompt'=>'选择省份',
                'style'=>'width:33%;padding-right:1%;display: inline-block;']
        ],
        'city'=>[
            'attribute'=>'city',
            'items'=>DdRegion::getRegion($model['province']),
            'options'=>['class'=>'form-control form-control-inline','prompt'=>'选择城市',
                'style'=>'width:33%;padding-right:1%;display: inline-block;']
        ],
        'district'=>[
            'attribute'=>'district',
            'items'=>DdRegion::getRegion($model['city']),
            'options'=>['class'=>'form-control form-control-inline','prompt'=>'选择县/区',
                'style'=>'width:33%;padding-right:1%;display: inline-block;']
        ]
    ]);
    ?>
    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'method')->radioList(['10'=>'按件数','11'=>'按重量']) ?>

    <?= $form->field($model, 'sort')->textInput() ?>



    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
        </div>
    </div>

    <?php MyActiveForm::end(); ?>

</div>
